from django.db import models
from django.contrib.auth.models import AbstractUser # # 导入django管理系统的抽象用户模型
from db.base_model import BaseModel # 导入自定义的基础模型抽象类

# Create your models here.
class User(AbstractUser, BaseModel):
    '''用户模型类'''

    # 性别枚举
    gender_choices = (
        (0, '男'),
        (1, '女'),
    )

    # 用户组枚举
    user_group_choices = (
        (0,'性能组'),
        (1,'普通组'),
        (2,'开发组'),
    )

    # 角色枚举
    role_choices = (
        (0,'组员'),
        (1,'组长'),
        (2,'普通用户'),
        (3,'管理员'),
    )

    nickname = models.CharField(max_length=20, verbose_name='用户昵称')
    gender = models.SmallIntegerField(default=0, choices=gender_choices, verbose_name='性别')
    user_group = models.SmallIntegerField(default=0, choices=user_group_choices, verbose_name='用户组')
    role = models.SmallIntegerField(default=0, choices=role_choices, verbose_name='角色')
    # phone = models.CharField(max_length=11, null=True, unique=True)
    phone = models.CharField(max_length=11, null=True)


    class Meta:
        db_table = 'pf_user'
        verbose_name = '用户'
        verbose_name_plural = verbose_name